--= Default Minetest

-- Wood

local S = minetest.get_translator("default")

stairs.register_all("wood", "default:wood",
	{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	{"default_wood.png"},
	S("Wooden"),
	nil, false)

stairs.register_all("junglewood", "default:junglewood",
	{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	{"default_junglewood.png"},
	S("Jungle Wood"),
	nil, false)

stairs.register_all("pine_wood", "default:pinewood",
	{choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
	{"default_pine_wood.png"},
	S("Pine Wood"),
	nil, false)

-- Register aliases for new pine node names
minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")

stairs.register_all("acacia_wood", "default:acacia_wood",
	{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
	{"default_acacia_wood.png"},
	S("Acacia Wood"),
	nil, false)

stairs.register_all("aspen_wood", "default:aspen_wood",
	{choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
	{"default_aspen_wood.png"},
	S("Aspen Wood"),
	nil, false)

-- Stone

stairs.register_all("stone", "default:stone",
	{cracky = 3},
	{"default_stone.png"},
	S("Stone"),
	nil, true)

stairs.register_all("stonebrick", "default:stonebrick",
	{cracky = 2},
	{"default_stone_brick.png"},
	S("Stone Brick"),
	nil, false)

stairs.register_all("stone_block", "default:stone_block",
	{cracky = 2},
	{"default_stone_block.png"},
	S("Stone Block"),
	nil, true)

stairs.register_all("cobble", "default:cobble",
	{cracky = 3},
	{"default_cobble.png"},
	S("Cobble"),
	nil, true)

stairs.register_all("mossycobble", "default:mossycobble",
	{cracky = 3},
	{"default_mossycobble.png"},
	S("Mossy Cobblestone"),
	nil, true)

stairs.register_all("desert_stone", "default:desert_stone",
	{cracky = 3},
	{"default_desert_stone.png"},
	S("Desert Stone"),
	nil, true)

stairs.register_all("desert_stonebrick", "default:desert_stonebrick",
	{cracky = 2},
	{"default_desert_stone_brick.png"},
	S("Desert Stone Brick"),
	nil, false)

stairs.register_all("desert_stone_block", "default:desert_stone_block",
	{cracky = 2},
	{"default_desert_stone_block.png"},
	S("Desert Stone Block"),
	nil, true)

stairs.register_all("desert_cobble", "default:desert_cobble",
	{cracky = 3},
	{"default_desert_cobble.png"},
	S("Desert Cobble"),
	nil, true)

-- Sandstone

stairs.register_all("sandstone", "default:sandstone",
	{crumbly = 1, cracky = 3},
	{"default_sandstone.png"},
	S("Sandstone"),
	nil, true)

stairs.register_all("sandstonebrick", "default:sandstonebrick",
	{cracky = 2},
	{"default_sandstone_brick.png"},
	S("Sandstone Brick"),
	nil, false)

stairs.register_all("sandstone_block", "default:sandstone_block",
	{cracky = 2},
	{"default_sandstone_block.png"},
	S("Sandstone Block"),
	nil, true)

stairs.register_all("desert_sandstone", "default:desert_sandstone",
	{crumbly = 1, cracky = 3},
	{"default_desert_sandstone.png"},
	S("Desert Sandstone"),
	nil, true)

stairs.register_all("desert_sandstone_brick", "default:desert_sandstone_brick",
	{cracky = 2},
	{"default_desert_sandstone_brick.png"},
	S("Desert Sandstone Brick"),
	nil, false)

stairs.register_all("desert_sandstone_block", "default:desert_sandstone_block",
	{cracky = 2},
	{"default_desert_sandstone_block.png"},
	S("Desert Sandstone Block"),
	nil, true)

stairs.register_all("silver_sandstone", "default:silver_sandstone",
	{crumbly = 1, cracky = 3},
	{"default_silver_sandstone.png"},
	S("Silver Sandstone"),
	nil, true)

stairs.register_all("silver_sandstone_brick", "default:silver_sandstone_brick",
	{cracky = 2},
	{"default_silver_sandstone_brick.png"},
	S("Silver Sandstone Brick"),
	nil, false)

stairs.register_all("silver_sandstone_block", "default:silver_sandstone_block",
	{cracky = 2},
	{"default_silver_sandstone_block.png"},
	S("Silver Sandstone Block"),
	nil, true)

-- Obsidian

stairs.register_all("obsidian", "default:obsidian",
	{cracky = 1, level = 2},
	{"default_obsidian.png"},
	S("Obsidian"),
	nil, true)

stairs.register_all("obsidianbrick", "default:obsidianbrick",
	{cracky = 1, level = 2},
	{"default_obsidian_brick.png"},
	S("Obsidian Brick"),
	nil, false)

stairs.register_all("obsidian_block", "default:obsidian_block",
	{cracky = 1, level = 2},
	{"default_obsidian_block.png"},
	S("Obsidian Block"),
	nil, true)

-- Cloud (with overrides)

stairs.register_stair("cloud", "default:cloud",
	{unbreakable = 1, not_in_creative_inventory = 1},
	{"default_cloud.png"},
	stairs.S("Cloud Stair"),
	nil)

minetest.override_item("stairs:stair_cloud", {
	on_blast = function() end,
	on_drop = function(itemstack, dropper, pos) end,
	drop = {},
})

stairs.register_slab("cloud", "default:cloud",
	{unbreakable = 1, not_in_creative_inventory = 1},
	{"default_cloud.png"},
	stairs.S("Cloud Slab"),
	nil)

minetest.override_item("stairs:slab_cloud", {
	on_blast = function() end,
	on_drop = function(itemstack, dropper, pos) end,
	drop = {},
})

-- Ores

stairs.register_all("coal", "default:coalblock",
	{cracky = 3},
	{"default_coal_block.png"},
	S("Coal"),
	nil, true)

stairs.register_all("steelblock", "default:steelblock",
	{cracky = 1, level = 2},
	{"default_steel_block.png"},
	S("Steel"),
	nil, true)

stairs.register_all("copperblock", "default:copperblock",
	{cracky = 1, level = 2},
	{"default_copper_block.png"},
	S("Copper"),
	nil, true)

stairs.register_all("bronzeblock", "default:bronzeblock",
	{cracky = 1, level = 2},
	{"default_bronze_block.png"},
	S("Bronze"),
	nil, true)

stairs.register_all("tinblock", "default:tinblock",
	{cracky = 1, level = 2},
	{"default_tin_block.png"},
	S("Tin"),
	nil, true)

stairs.register_all("mese", "default:mese",
	{cracky = 1, level = 2},
	{"default_mese_block.png"},
	S("Mese"),
	nil)

stairs.register_all("goldblock", "default:goldblock",
	{cracky = 1},
	{"default_gold_block.png"},
	S("Gold"),
	nil)

stairs.register_all("diamondblock", "default:diamondblock",
	{cracky = 1, level = 3},
	{"default_diamond_block.png"},
	S("Diamond"),
	nil)

-- Setting to show glass stair sides
local gsides = minetest.settings:get_bool("stairs.glass_sides") ~= false

-- Old glass stairs
--stairs.register_all("glass", "default:glass",
--	{cracky = 3, oddly_breakable_by_hand = 3},
--	{"default_glass.png"},
--	"Glass",
--	stairs.glass)

-- Glass (stairs registered seperately to use special texture)

local face_tex = "default_glass.png"
local side_tex = gsides and "stairs_glass_quarter.png" or face_tex

stairs.register_stair(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{side_tex, face_tex, side_tex, side_tex, face_tex, side_tex},
	S("Glass Stair"),
	nil,
	false
)

stairs.register_slab(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{face_tex, face_tex, side_tex},
	S("Glass Slab"),
	nil,
	false
)

stairs.register_stair_inner(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{side_tex, face_tex, side_tex, face_tex, face_tex, side_tex},
	"",
	nil,
	false,
	S("Inner Glass Stair")
)

stairs.register_stair_outer(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{side_tex, face_tex, side_tex, side_tex, side_tex, side_tex},
	"",
	nil,
	false,
	S("Outer Glass Stair")
)

stairs.register_slope(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{face_tex},
	S("Glass Slope"),
	nil
)

stairs.register_slope_inner(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{face_tex},
	S("Glass Inner Slope"),
	nil
)

stairs.register_slope_outer(
	"glass",
	"default:glass",
	{cracky = 3, oddly_breakable_by_hand = 3},
	{face_tex},
	S("Glass Outer Slope"),
	nil
)

-- Old obsidian glass stairs
--stairs.register_all("obsidian_glass", "default:obsidian_glass",
--	{cracky = 2},
--	{"default_obsidian_glass.png"},
--	"Obsidian Glass",
--	stairs.glass)

-- Obsidian Glass (stairs registered seperately to use special texture)

face_tex = "default_obsidian_glass.png"
side_tex = gsides and "stairs_obsidian_glass_quarter.png" or face_tex

stairs.register_stair(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{side_tex, face_tex, side_tex, side_tex, face_tex, side_tex},
	S("Obsidian Glass Stair"),
	nil,
	false
)

stairs.register_slab(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{face_tex, face_tex, side_tex},
	S("Obsidian Glass Slab"),
	nil,
	false
)

stairs.register_stair_inner(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{side_tex, face_tex, side_tex, face_tex, face_tex, side_tex},
	"",
	nil,
	false,
	S("Inner Obsidian Glass Stair")
)

stairs.register_stair_outer(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{side_tex, face_tex, side_tex, side_tex, side_tex, side_tex},
	"",
	nil,
	false,
	S("Outer Obsidian Glass Stair")
)

stairs.register_slope(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{face_tex},
	S("Obsidian Glass Slope"),
	nil
)

stairs.register_slope_inner(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{face_tex},
	S("Obsidian Glass Inner Slope"),
	nil
)

stairs.register_slope_outer(
	"obsidian_glass",
	"default:obsidian_glass",
	{cracky = 2},
	{face_tex},
	S("Obsidian Glass Outer Slope"),
	nil
)

-- Brick, Snow and Ice

stairs.register_all("brick", "default:brick",
	{cracky = 3},
	{"default_brick.png"},
	S("Brick"),
	nil, false)

stairs.register_all("snowblock", "default:snowblock",
	{crumbly = 3, cools_lava = 1, snowy = 1},
	{"default_snow.png"},
	S("Snow Block"),
	nil, true)

stairs.register_all("ice", "default:ice",
	{cracky = 3, cools_lava = 1},
	{"default_ice.png"},
	S("Ice"),
	nil, true)

-- More Ores mod

if minetest.get_modpath("moreores") then

	stairs.register_all("silver_block", "moreores:silver_block",
		{cracky = 1, level = 2},
		{"moreores_silver_block.png"},
		minetest.get_translator("moreores")("Silver"),
		nil, true)

	stairs.register_all("mithril_block", "moreores:mithril_block",
		{cracky = 1, level = 2},
		{"moreores_mithril_block.png"},
		minetest.get_translator("moreores")("Mithril"),
		nil, true)
end

-- Mobs mod

if minetest.registered_nodes["mobs:cheeseblock"] then

	stairs.register_all("cheeseblock", "mobs:cheeseblock",
		{crumbly = 3, flammable = 2},
		{"mobs_cheeseblock.png"},
		minetest.get_translator("mobs_animal")("Cheese Block"),
		nil)

	stairs.register_all("honey_block", "mobs:honey_block",
		{crumbly = 3, flammable = 2},
		{"mobs_honey_block.png"},
		minetest.get_translator("mobs_animal")("Honey Block"),
		nil)
end

-- Lapis mod

if minetest.get_modpath("lapis") then

	stairs.register_all("lapis_block", "lapis:lapisblock",
		{cracky = 3},
		{"lapis_block_side.png"},
		minetest.get_translator("lapis")("Lapis Lazuli Block"),
		nil)
end

-- Homedecor mod

if minetest.get_modpath("homedecor") then

	stairs.register_all("shingles_asphalt", "homedecor:shingles_asphalt",
		{snappy = 3},
		{"homedecor_shingles_asphalt.png"},
		minetest.get_translator("homedecor_roofing")("Asphalt Shingles"),
		nil)

	stairs.register_all("shingles_terracotta", "homedecor:shingles_terracotta",
		{snappy = 3},
		{"homedecor_shingles_terracotta.png"},
		minetest.get_translator("homedecor_roofing")("Terracotta Shingles"),
		nil)

	stairs.register_all("shingles_wood", "homedecor:shingles_wood",
		{snappy = 3},
		{"homedecor_shingles_wood.png"},
		minetest.get_translator("homedecor_roofing")("Wooden Shingles"),
		nil)
end

-- Xanadu mod

if minetest.get_modpath("xanadu") then

	stairs.register_all("stained_wood_white", "xanadu:stained_wood_white",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
		{"stained_wood_white.png"},
		"White Wooden",
		nil, false)

	stairs.register_all("stained_wood_red", "xanadu:stained_wood_red",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
		{"stained_wood_red.png"},
		"Red Wooden",
		nil, false)

	stairs.register_all("stone1", "xanadu:stone1",
		{cracky = 3},
		{"stone1.png"},
		"Decorative Stone 1",
		nil)

	stairs.register_all("stone2", "xanadu:stone2",
		{cracky = 3},
		{"stone2.png"},
		"Decorative Stone 2",
		nil)

	stairs.register_all("stone3", "xanadu:stone3",
		{cracky = 3},
		{"stone3.png"},
		"Decorative Stone 3",
		nil)

	stairs.register_all("stone4", "xanadu:stone4",
		{cracky = 3},
		{"stone4.png"},
		"Decorative Stone 4",
		nil)

	stairs.register_all("stone5", "xanadu:stone5",
		{cracky = 3},
		{"stone5.png"},
		"Decorative Stone 5",
		nil)

	stairs.register_all("stone6", "moreblocks:stone_tile",--"xanadu:stone6",
		{cracky = 3},
		{"stone6.png"},
		"Decorative Stone 6",
		nil)

	stairs.register_all("sandstonebrick1", "xanadu:sandstonebrick1",
		{cracky = 3},
		{"sandstonebrick1.png"},
		"Decorative Sandstone 1",
		nil)

	stairs.register_all("sandstonebrick2", "xanadu:sandstonebrick2",
		{cracky = 3},
		{"sandstonebrick2.png"},
		"Decorative Sandstone 2",
		nil)

	stairs.register_all("sandstonebrick4", "xanadu:sandstonebrick4",
		{cracky = 3},
		{"sandstonebrick4.png"},
		"Decorative Sandstone 4",
		nil)

	stairs.register_slab("desert_cobble1", "xanadu:desert_cobble1",
		{cracky = 3},
		{"desert_cobble1.png"},
		"Decorative desert cobble 1 slab",
		nil)

	stairs.register_slab("desert_cobble5", "xanadu:desert_cobble5",
		{cracky = 3},
		{"desert_cobble5.png"},
		"Decorative desert cobble 5 slab",
		nil)

	stairs.register_slab("desert_stone1", "xanadu:desert_stone1",
		{cracky = 3},
		{"desert_stone1.png"},
		"Decorative desert stone 1 slab",
		nil)

	stairs.register_slab("desert_stone3", "xanadu:desert_stone3",
		{cracky = 3},
		{"desert_stone3.png"},
		"Decorative desert stone 3 slab",
		nil)

	stairs.register_slab("desert_stone4", "xanadu:desert_stone4",
		{cracky = 3},
		{"desert_stone4.png"},
		"Decorative desert stone 4 slab",
		nil)

	stairs.register_stair("desert_stone4", "xanadu:desert_stone4",
		{cracky = 3},
		{"desert_stone4.png"},
		"Decorative desert stone 4 stair",
		nil)

	stairs.register_slab("desert_stone5", "xanadu:desert_stone5",
		{cracky = 3},
		{"desert_stone5.png"},
		"Decorative desert stone 5 slab",
		nil)

	stairs.register_slab("red1", "xanadu:red1",
		{cracky = 3},
		{"baked_clay_red1.png"},
		"Decorative baked red clay 1 slab",
		nil)

	stairs.register_all("bred2", "xanadu:red2",
		{cracky = 3},
		{"baked_clay_red2.png"},
		"Decorative baked red clay 2",
		nil)

	stairs.register_all("compressed_cobble", "xanadu:compressed_cobble",
		{cracky = 3, level = 2},
		{"compressed_cobble.png"},
		"Compressed Cobble",
		nil)

	stairs.register_all("compressed_dirt", "xanadu:compressed_dirt",
		{crumbly = 2},
		{"compressed_dirt.png"},
		"Compressed Dirt",
		nil)

	stairs.register_all("goldblock1", "xanadu:goldblock1",
		{cracky = 1},
		{"gold_block1.png"},
		"Decorative Goldblock 1",
		nil)

	stairs.register_slope("steelblock1", "xanadu:steelblock1",
		{cracky = 1, level = 2},
		{"steel_block1.png"},
		"Decorative Steelblock 1",
		nil)

	stairs.register_slab("steelblock3", "xanadu:steelblock3",
		{cracky = 1, level = 2},
		{"steel_block3.png"},
		"Decorative Steelblock 3",
		nil)

	stairs.register_slope("steelblock5", "xanadu:steelblock5",
		{cracky = 1, level = 2},
		{"steel_block5.png"},
		"Decorative Steelblock 5",
		nil)

	stairs.register_slab("sandstone4", "xanadu:sandstone4",
		{crumbly = 2, cracky = 3},
		{"sandstone4.png"},
		"Decorative sandstone 4 slab",
		nil)
end

-- Castle mod

if minetest.get_modpath("castle") then

	stairs.register_all("dungeon_stone", "castle:dungeon_stone",
		{cracky = 2},
		{"castle_dungeon_stone.png"},
		minetest.get_translator("castle_masonry")("Dungeon Stone"),
		nil)

	stairs.register_all("stonewall", "castle:stonewall",
		{cracky = 2},
		{"castle_stonewall.png"},
		stairs.S("Castle Wall"),
		nil)
end

-- Wool mod

if minetest.get_modpath("wool") then

	local colours = {
		{"black", "Black"},
		{"blue", "Blue"},
		{"brown", "Brown"},
		{"cyan", "Cyan"},
		{"dark_green", "Dark Green"},
		{"dark_grey", "Dark Grey"},
		{"green", "Green"},
		{"grey", "Grey"},
		{"magenta", "Magenta"},
		{"orange", "Orange"},
		{"pink", "Pink"},
		{"red", "Red"},
		{"violet", "Violet"},
		{"white", "White"},
		{"yellow", "Yellow"},
	}

	for i = 1, #colours, 1 do

		stairs.register_all("wool_" .. colours[i][1], "wool:" .. colours[i][1],
			{snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3},
			{"wool_" .. colours[i][1] .. ".png"},
			minetest.get_translator("wool")(colours[i][2] .. " Wool"),
			nil) -- nil to use node's own sounds
	end
end
